package com.zj.ssm.controller;

import com.zj.ssm.pojo.domain.Subscribe;
import com.zj.ssm.pojo.domain.query.SubscribeQuery;

import com.zj.ssm.result.AjaxResult;
import com.zj.ssm.service.SubscribeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLOutput;

@RestController
@RequestMapping("sub")
/**
 * @author:Coco
 * @date:2022/2/1615:16
 * @version:1.8
 */
public class SubscribeController {
    @Autowired
    private SubscribeService subscribeService;


    @RequestMapping("query")
    public AjaxResult query(SubscribeQuery query){
        return subscribeService.querySubscribe(query);
    }
    @RequestMapping("add")
    public AjaxResult add(Subscribe subscribe){
        return subscribeService.addSubscribe(subscribe);
    }
    @RequestMapping("delete/{id}")
    public AjaxResult add(@PathVariable("id")Integer id){
        return subscribeService.deleteSubscrilbe(id);
    }
    @RequestMapping("get/{id}")
    public AjaxResult get(@PathVariable("id")Integer id){
        return subscribeService.getSubscrilbe(id);
    }
    @RequestMapping("update")
    public AjaxResult update(Subscribe subscribe){
        return subscribeService.updateSubscrilbe(subscribe);
    }

}
